Added specs for the latlng property

Chris Eidhof 10 years ago
parent
commit
ed778fcfe0
1 changed files with 5 additions and 0 deletions
  1. 5 0
      spec/lib/location_spec.rb

+ 5 - 0
spec/lib/location_spec.rb

@@ -30,6 +30,10 @@ describe Location do
30 30
     expect(location['lat']).to eq 2.0
31 31
   end
32 32
 
33
+  it "has a convencience accessor for combined latitude and longitude" do
34
+    expect(location.latlng).to eq "2.0,3.0"
35
+  end
36
+
33 37
   it "does not allow hash-style assignment" do
34 38
     expect {
35 39
       location[:lat] = 2.0
@@ -60,6 +64,7 @@ describe Location do
60 64
       '{{location.latitude}}' => '2.0',
61 65
       '{{location.lng}}' => '3.0',
62 66
       '{{location.longitude}}' => '3.0',
67
+      '{{location.latlng}}' => '2.0,3.0',
63 68
     }.each { |template, result|
64 69
       expect(Liquid::Template.parse(template).render('location' => location.to_liquid)).to eq(result),
65 70
         "expected #{template.inspect} to expand to #{result.inspect}"